/**
 * Created by luyon on 17/3/15.
 */


"use strict";

// ===========
// 程序依赖导入
// ===========
import { combineReducers, createStore, applyMiddleware } from 'redux' ;
import thunk from 'redux-thunk' ;

// ==================
// 公用组建reducer导入
// ==================


// ==================
// 一级组建reducer导入
// ==================


/**
 *
 *      MIZHI
 *
 * */
//登录机
import { LoginReducers } from '../views/Login/LoginRedux' ;
//注册状态机
import { RegisReducers } from '../views/Regis/RegisRedux'
//App
import { AppReducers } from '../views/App/AppRedux' ;
//手机绑定
import { MobileBindingReducers } from  '../views/MobileBinding/MobileBindingRedux' ;
//详情页面
import { MobileFileDetailReducers} from '../views/App/MobileFilmDetail/MobileFilmDetailRedux' ;

/***
 *  定义全局状态机，进行命名和结构化状态机
 *
 *  combineReducers({
 *      name1 : componentReducer1 ,
 *      name2 : componentReducer2 ,
 *      name3 : componentReducer3 ,
 *      .
 *      .
 *      .
 *  })
 *
 */


export const __ROOTREDUCERS__ = combineReducers({
    app                 :   AppReducers ,
    login               :   LoginReducers ,
    regis               :   RegisReducers ,
    mobileBinding       :   MobileBindingReducers ,
    mobileFilmInfo      :   MobileFileDetailReducers ,
}) ;


// ======================
// 应用总状态机 , 带有中间件
// ======================

/**
 *
 *            applyMiddleware(中间件名称)
 *
 *     thunk中间件可使得派发函数为参数，但是不可异步函数
 *
 * */

export const __STORE__ = createStore(__ROOTREDUCERS__, applyMiddleware(thunk)) ;

